<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let obj = {
      uname: 'cxkk',
      age: 18,
      gender: '男'
    }

    // for in 的用法

    for (let key in obj) {
      // 打印出对象中的属性名
      console.log(key);
      // 打印出对象中的属性值
      console.log(obj[key]);
    }

// 遍历对象用for in
// 遍历数组用for of
// for(let [index,,element] of arr.entries()){
//   index  索引下标
//   // element  数组的每一项
// }
  </script>
</body>

</html>